package com.apes.fico.engine.service;

import com.apes.fico.engine.model.ElementChart;
import com.apes.fico.engine.repository.ElementChartRepository;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName ElementChartService
 * @Description TODO
 * @Author pengyb
 * @Date 2019/1/28 17:50
 * @Version 1.0
 **/
@Service("elementChartService")
public class ElementChartService extends DomainService {
    @Autowired
    private ElementChartRepository elementChartRepository;

    /**
     * 保存
     *
     * @param request
     * @return
     */
    public ElementChart create(SimpleRequest request) {
        ElementChart elementChart = request.getO(ElementChart.class);
        return elementChartRepository.save(elementChart);
    }

    /**
     * 编辑
     *
     * @param request
     * @return
     */
    public ElementChart update(SimpleRequest request) {
        ElementChart elementChart = request.getO(ElementChart.class);
        return elementChartRepository.saveAndFlush(elementChart);
    }

}
